__all__ = ['Event']


class Event:
    __setitem__ = object.__setattr__
    __getitem__ = object.__getattribute__

    def __init__(self, type, **kwargs):
        self.type = type
        self.print = []
        self._dict = {}
        for k, v in kwargs.items():
            self[k] = v
            self._dict[k] = v

    def __eq__(self, other):
        return isinstance(other, self.__class__) and \
            self.type == other.type and \
            self._dict == other._dict

    def __repr__(self):
        ret = 'Event(' + repr(self.name) + ', '
        for k, v in self._dict.items():
            ret += repr(k) + '=' + repr(v)
            ret += ', '
        return ret[:-2] + ')'
